

function foo<T,E,O>(arg1:T,arg2:E, arg3:O, ...args:T[]){

}

foo<number,string,boolean>(10,'123',true)

// E -- element, O-- object,  K--- key, V--value


class Point<T> {
    x:T
    y:T
    z:T
    constructor(x:T, y:T, z:T){
        this.x = x
        this.y = y
        this.z = z
    }
}

const p1 = new Point('1.33.2','2.22.3','3.241')
const p2 = new Point<string>('1.33.2','2.22.3','3.241')
const p3: Point<number> = new Point(132,456,456)

const names1: string[] = ['abc','cba','nba']
const names2: Array<string> = ['abc','cba','nba'] // 不推荐


// 类型约束
interface ILength {
    length: number
}

function getLength<T extends ILength>(arg: T){
    return arg.length
}

// getLength(123)  报错
getLength('123')



export {}